package com.hyf.gateway.web;

import com.hyf.gateway.event.RefreshRouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.zuul.web.ZuulHandlerMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {

    @Autowired
    RefreshRouteService refreshRouteService;

    @RequestMapping(value = "/refreshRoute")
    public String refreshRoute(){
        //刷新路由
        refreshRouteService.refreshRoute();
        return "refreshRoute";
    }

    @Autowired
    ZuulHandlerMapping zuulHandlerMapping;

    @RequestMapping(value = "watchNowRoute")
    public String watchNowRoute(){
        //可以debug具体看里面是什么
        zuulHandlerMapping.getHandlerMap();
        return "watchNowRoute";
    }

}
